package client

import (
	"context"
	"fmt"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"order-srv/libs"
)

// GetClientConn 获取grpc客户端链接
func GetClientConn(ctx context.Context) (*grpc.ClientConn, error) {
	var opts []grpc.DialOption
	opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))

	address := fmt.Sprintf("%s:%d", libs.AppConfig.IP, libs.AppConfig.Port)
	return grpc.DialContext(ctx, address, opts...)
}
